<?php



class AjaxController {
	
	var $email = 'miguel@closas.ch';
	
	public function init(){
		
		//$feUserObject = tslib_eidtools::initFeUser();
		//$TSFEObject = tslib_eidtools::getTSFE();
		return t3lib_div::_GP('eID');
	}
	
	
	public function sendEmail(){
 		$empfaenger = trim(t3lib_div::_GP('sendemail'));
 		$betreff = 'Contact site internet bertrand ' . t3lib_div::_GP('name');
 		$nachricht = 'Name: '.t3lib_div::_GP('name') . "\r\n" . 'E-Mail: ' . t3lib_div::_GP('email') . "\r\n" . 'Text: ' .t3lib_div::_GP('text');
 		$header = 'From: '.$empfaenger. "\r\n" .
 				'Reply-To: '.$empfaenger. "\r\n";
 		
 		mail($empfaenger, $betreff, $nachricht, $header);
		exit;		
	}
	
}


$obj = new AjaxController();
if($obj->init() == "kontaktform"){
	$obj->sendEmail();
}



?>